.App {
  text-align: center;
  padding: 20px;
  min-height: 100vh;
  background-color: #f5f5f5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

h1 {
  color: #333;
  margin-bottom: 30px;
  font-size: clamp(1.5em, 4vw, 2.5em);
}

/* 控制区域 */
.controls {
  margin-bottom: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.difficulty-select {
  padding: 8px 12px;
  font-size: 16px;
  border: 2px solid #4CAF50;
  border-radius: 5px;
  background-color: white;
  color: #333;
  cursor: pointer;
  min-width: 120px;
}

button {
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 5px;
  transition: all 0.2s ease;
  min-width: 100px;
}

button:hover {
  background-color: #45a049;
  transform: translateY(-2px);
}

button:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
  transform: none;
}

/* 游戏板布局 */
.game-board {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 20px auto;
  max-width: 100%;
  overflow: auto;
}

.board-wrapper {
  background-color: white;
  padding: clamp(10px, 2vw, 20px);
  border-radius: 8px;
  display: inline-block;
}

.board-content {
  position: relative;
  display: flex;
  flex-direction: column;
}

/* 列提示区域 */
.col-hints {
  display: flex;
  margin-left: 10px;
  min-height: 30px;
  align-items: flex-end;
  position: relative;
  margin-bottom: 5px;
}

.spacer {
  width: 60px;
  flex-shrink: 0;
}

.hint-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: var(--cell-size);
  position: relative;
}

.hint-column .hint {
  position: relative;
  top: 50%;
  margin-bottom: 4px;
}

/* 主要游戏区域 */
.board-main {
  display: flex;
}

.row-hints {
  display: flex;
  flex-direction: column;
  width: 60px;
  flex-shrink: 0;
  margin-right: 10px;
}

.hint-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: var(--cell-size);
  padding: 2px;
  gap: 4px;
}

.hint {
  font-size: 14px;
  color: #000;
  font-weight: bold;
  display: inline-block;
  text-align: center;
  line-height: 1;
}

/* 网格区域 */
.grid {
  background-color: white;
  border: 2px solid #0f0;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.row {
  display: flex;
  height: var(--cell-size);
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  border: 1px solid #0f0;
  background-color: white;
  cursor: pointer;
  transition: background-color 0.2s ease;
  position: relative;
  box-sizing: border-box;
}

.cell:hover {
  background-color: #e9ecef;
}

.cell.filled {
  background-color: #000;
}

/* 状态提示 */
.loading {
  margin: 20px 0;
  color: #666;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.loading::after {
  content: '';
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.error {
  margin: 20px 0;
  padding: 15px;
  color: #721c24;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 5px;
}

.message {
  margin: 20px 0;
  padding: 15px;
  border-radius: 5px;
  font-size: clamp(14px, 1.5vw, 18px);
  animation: fadeIn 0.5s ease;
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

/* 动画 */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 响应式布局 */
:root {
  --cell-size: 40px;
  --border-color: #666;
  --grid-border-color: #888;
  --filled-color: #4a5568;
  --hover-color: #edf2f7;
  --background-color: white;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  .controls {
    flex-direction: column;
    gap: 10px;
  }

  .difficulty-select {
    width: 200px;
  }

  .board-wrapper {
    padding: 10px;
  }

  :root {
    --cell-size: 30px;
  }

  .board-wrapper[data-size="5"] {
    --cell-size: 45px;
  }

  .board-wrapper[data-size="10"] {
    --cell-size: 30px;
  }

  .board-wrapper[data-size="15"] {
    --cell-size: 20px;
  }

  .hint {
    font-size: 10px;
    min-width: 12px;
    height: 14px;
    padding: 1px 2px;
  }

  .hint-row, .hint-column {
    gap: 2px;
  }

  .board-wrapper[data-size="5"] .hint {
    font-size: 14px;
    min-width: 18px;
    height: 18px;
    padding: 2px 4px;
  }

  .board-wrapper[data-size="10"] .hint {
    font-size: 12px;
    min-width: 16px;
    height: 16px;
    padding: 2px 3px;
  }

  .board-wrapper[data-size="15"] .hint {
    font-size: 10px;
    min-width: 14px;
    height: 14px;
    padding: 1px 2px;
  }
}

/* 小屏幕设备 */
@media (max-width: 480px) {
  .container {
    padding: 5px;
  }

  :root {
    --cell-size: 25px;
  }

  .board-wrapper[data-size="5"] {
    --cell-size: 40px;
  }

  .board-wrapper[data-size="10"] {
    --cell-size: 25px;
  }

  .board-wrapper[data-size="15"] {
    --cell-size: 18px;
  }

  .hint {
    font-size: 10px;
  }

  .board-wrapper[data-size="5"] .hint {
    font-size: 12px;
    min-width: 16px;
    height: 16px;
    padding: 2px 3px;
  }

  .board-wrapper[data-size="10"] .hint {
    font-size: 10px;
    min-width: 14px;
    height: 14px;
    padding: 1px 2px;
  }

  .board-wrapper[data-size="15"] .hint {
    font-size: 9px;
    min-width: 12px;
    height: 12px;
    padding: 1px 2px;
  }
}

/* 确保在大屏幕上不会过大 */
@media (min-width: 1200px) {
  .board-wrapper[data-size="5"] {
    --cell-size: 60px;
  }

  .board-wrapper[data-size="10"] {
    --cell-size: 45px;
  }

  .board-wrapper[data-size="15"] {
    --cell-size: 35px;
  }
}

/* 移动端适配中添加颜色变量 */
@media (prefers-color-scheme: dark) {
  :root {
    --border-color: #888;
    --grid-border-color: #999;
    --filled-color: #718096;
    --hover-color: #e2e8f0;
    --background-color: #fff;
  }
}

.button.hint {
  background-color: #3498db;
}

.button.hint:hover {
  background-color: #2980b9;
}

.button.hint:disabled {
  background-color: #bdc3c7;
}
 